package com.wzh.example;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author zh wang
 * @Create 2025/3/13 10:06
 */
public class Demo {
    public static void main(String[] args) {
        test_01();

    }

    /**
     *  集合的深拷贝和浅拷贝
     */
    public static void test_01(){
        ArrayList<User> list1 = new ArrayList<>();
        list1.add(new User("zhangsan", 18, "男"));
        list1.add(new User("lisi", 19, "男"));
        list1.add(new User("wangwu", 20, "男"));
        list1.add(new User("zhaoliu", 21, "女"));
        List<User> collect = list1.stream().filter(user -> user.getAge() > 18).
                collect(Collectors.toList());

        System.out.println("list1 = " + list1);
        //boolean b = list1.removeAll(collect);
        collect.get(0).setAge(22);
        System.out.println("list1 = " + list1);

        HashMap<String, String> map = new HashMap<>();
        map.put(null, null);
        System.out.println("map = " + map);
    }
}
